package com.rest.demo.io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintStream;

/**
 * @author Administrator
 * @decription
 * @Date 2018-02-05 15:32
 */
public class PrintStreamDemo {
    public static void main(String[] args) {
        PrintStream ps = null;
        try {
            ps = new PrintStream(new FileOutputStream("F:\\out.txt"));
            String name = "yangbo";
            int age = 20;
            ps.printf("姓名：%s. 年龄：%d.",name,age);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } finally {
            ps.close();
        }
    }
}
